home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-20 | 3.3 KB | 127 lines | [TEXT/MPS ] |
- BLANKS ON
- STRING ASIS
-
- PRINT OFF
- INCLUDE 'ToolEqu.a'
- INCLUDE 'Traps.a'
- INCLUDE 'SysEqu.a'
- INCLUDE 'QuickEqu.a'
- PRINT ON
-
- WDEF0 PROC EXPORT
-
- ;
- ; FUNCTION DocProc(selector: INTEGER;
- ; window: WindowPtr,
- ; message: INTEGER;
- ; parameter: LongInt): LongInt
-
- LinkSize EQU -34
- grafRsrcH equ -16
- oldResRef equ -12
- wdef0state equ -8
- wdefhandle equ -4
-
- message EQU 12 ; <C666/22Jan87> DAF
-
- HasZoom EQU 3 ; bit 3 is zoom bit <EHB 29Aug85>
- hasGrow EQU 2 ; bit 2 is grow bit <EHB 29Aug85>
-
- DocProc
- BRA.S DP1
-
- ; standard header
-
- DC.W 0 ; flags word
- DC.B 'WDEF' ; resource type
- DC.W 0 ; resource ID
- DC.W 10 ; version number
-
- DP1
- LINK A6,#LinkSize ; set up a stack frame to address parameters
- MOVEM.L D3-D7/A1-A4,-(SP) ; save work registers
-
- clr.w -(sp)
- _CurResFile
- move.w (sp)+,oldResRef(a6) ; save off the current res ref number
-
- clr.w -(sp) ; res ref number of system file
- _UseResFile ; point to system file
-
- clr.l -(sp) ; clear area for handle
- move.l #'WDEF',-(sp) ; resource type
- clr.w -(sp) ; res number is zero
- _Get1Resource ; get handle to system wdef resource
- move.l (sp)+,wdefhandle(a6) ; save the handle
-
- move.w oldResRef(a6),-(sp) ; original res ref number
- _UseResFile ; reset it
-
- move.w 18(a6),d0
- andi.w #$000f,d0
- cmpi.w #1,d0 ; is it a dialog type ?
- beq.s @2 ; if so then skip
-
- clr.l -(sp) ; clear area for handle
- move.l #'GRAF',-(sp) ; resource type
- clr.w -(sp) ; res number is zero
- _GetResource ; get handle to our interesting GRAF resource
- move.l (sp)+,grafRsrcH(a6) ; save the handle
-
- move.l grafRsrcH(a6),a0 ; get the handle
- move.l (a0),a0 ; de-ref it
- tst.l (a0) ; see if the first std proc has been inited.
- bne.s @1 ; if non-zero then it's already in
-
- bsr StartUpGRAF ; go start it
- @1
- move.l grafRsrcH(a6),a0 ; get the handle
- move.l (a0),a0 ; de-ref it
- move.l 14(a6),a1 ; get the window ptr
- move.l a0,grafProcs(a1) ; set the grafproc patch
- @2
- move.l wdefhandle(a6),a0 ;
- _HGetState ;
- move.b d0,wdef0state(a6) ; save the state
-
- move.l wdefhandle(a6),a0 ;
- _HLock ;
-
- clr.l -(sp) ; result
- move.w 18(a6),-(sp) ; selector
- move.l 14(a6),-(sp) ; window
- move.w 12(a6),-(sp) ; message
- move.l 8(a6),-(sp) ; parameter
- move.l wdefhandle(a6),a0 ; handle to wdef
- move.l (a0),a0 ; de-ref it
- jsr (a0) ; call the original wdef
- move.l (sp)+,20(a6) ; return result
-
- move.l wdefhandle(a6),a0 ;
- move.b wdef0state(a6),d0 ; the original state
- _HSetState ;
-
- MOVEM.L (SP)+,D3-D7/A1-A4 ; restore work registers
- UNLK A6 ; unlink stack frame
- MOVE.L (SP)+,A0 ; get return address
- ADD #12,SP ; strip parameters
- JMP (A0) ; return to caller
-
- StartUpGRAF
- move.l grafRsrcH(a6),a0 ;
- _HLock ; lock it down for-ever
-
- move.l grafRsrcH(a6),a0 ;
- move.l (a0),-(sp) ; put it on the stack
- _SetStdProcs
-
- move.l grafRsrcH(a6),a0 ;
- move.l (a0),a0 ; de-ref it
- move.l (a0),52(a0) ; copy the original StdText to our save area
- lea.l 56(a0),a1 ; get the address of where our hack starts at
- move.l a1,(a0) ; and patch the StdProc
-
- rts
-
- endp
- end